package sg.edu.nus.iss.vmcs.machinery;

import java.awt.event.*;
import java.awt.*;

import sg.edu.nus.iss.vmcs.store.StoreService;

public class StoreViewerListener implements ActionListener {

	private int type;
	private int item;
	private StoreService storeService;

	public StoreViewerListener(int type, int item, StoreService storeService) {
		this.type = type;
		this.item = item;
		this.storeService = storeService;

	}

	public void actionPerformed(ActionEvent e) {
		TextField vf;
		int qty;
		String sqty;

		vf = (TextField) e.getSource();
		sqty = vf.getText();
		qty = Integer.parseInt(sqty);
		storeService.changeStoreQty(type, item, qty);

	}
}